const defaultValue = {
	ip: '--',
	lossRate: 100,
	area: '',
	totalTime: 0,
	node: '',
	response: '',
};

export default function fillMissingNode(area, resp, nodeList) {
	const ret = resp;
	if (!resp?.detail?.length) {
		ret.detail = [];
	}

	const arr = resp.detail.map(item => item.node);
	area.forEach(node => {
		if (!arr.includes(node)) {
			resp.detail.push({
				...defaultValue,
				node,
				area: nodeList[node],
			});
		}
	});

	return ret;
}
